package com.chencong.udf;

import org.apache.flink.api.common.functions.FlatMapFunction;
import org.apache.flink.util.Collector;

/**
 * @Author chencong
 * @Description 自定义flatmap压平的函数
 * @Date 8:36 下午 2021/8/4
 * @Param
 **/
public class MyFlatMapFunc implements FlatMapFunction<String,String> {

    @Override
    public void flatMap(String s, Collector<String> collector) throws Exception {
        //按照","切割
        String[] words = s.split(",");

        //遍历，写出一个一个单词

        for (String word : words) {
            collector.collect(word);
        }
    }
}
